package com.bx.weixin.service;

import java.util.List;

import com.demo.common.model.Blog;
import com.demo.common.model.Company;
import com.demo.common.model.User;
import com.jfinal.plugin.activerecord.Page;

public class UserService {
	private static final User  dao = new User().dao();
	private static final Company  companyDao = new Company().dao();
	
	public Long count(){
		String sql = "select count(u.id) as count from bx_user u where u.state='1'";
		User user = dao.findFirst(sql);
		Long count = user.get("count");
		return count;
	}

	public List<Company> companyList() {
		String sql = "select c.* from bx_company c where c.state = '1'";
		List<Company> company = companyDao.find(sql);
		return company;
	}

	public Page<User> paginate(int pageNumber, int pageSize) {
		return dao.paginate(pageNumber, pageSize, "select *", "from bx_user u where u.state='1' order by u.create_time desc");
	}

}
